#pragma once

#include <e32base.h>
#include <aknkeylock.h> 

#include "SyncServer.pan"
#include "Settings.h"
#include "ActivityNotifier.h"
#include "AutolockSettings.h"

class CActivityTimer;

class CMyServer : public CServer2, public MActivityNotifier
{
public : 
    static CMyServer* NewLC();
    static TInt ThreadFunction();
	void IncrementSessions();
	void DecrementSessions();
	void LockKeypadL();
	void ReloadSettings();

private: 
    CMyServer(TInt aPriority);
    ~CMyServer();
    void ConstructL() ;
    static void ThreadFunctionL();
	void DoTimeOutL();
	static TInt AutoStopTimerTimeOut( TAny* aObj );
	void StopServerIfNoSessionsAndDisabled();

protected:
	void NotifyInactivityL();

private: // From CServer
	virtual CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;

public:
	CActivityTimer* iActivityTimer;
	CPeriodic* iAutoStopTimer;

	RFs iFs;
    TBool iServerDisabled;
    RAknKeyLock iKeyLock;
    TAutolockSettings iAutoLockSettings;
private:
    TInt iSessionCount;
};
